﻿// <copyright>
// Copyright (c) 2008 - 2009, Microsoft, All Rights Reserved
// </copyright>
//
// Licensed under the Microsoft Public License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at 
//
// http://www.opensource.org/licenses/ms-pl.html

namespace LiveLabs.Logging
{
    using System;

    /// <summary>
    /// Used by Logger to format a user supplied message.
    /// </summary>
    /// <param name="userMessage">The user's message</param>
    /// <param name="name">The name of the Logger formatting the message</param>
    /// <param name="level">The level of the message</param>
    /// <returns>A formatted string to be written to a Log</returns>
    /// <remarks>
    /// Implementations of this delegate should be forgiving of null or empty
    /// <paramref name="userMessage">user messages</paramref>.  <paramref name="name"/> 
    /// will never be null.  <paramref name="level"/> will always be a valid
    /// <see cref="LogLevel"/>.
    /// </remarks>
    public delegate string MessageFormatter(string userMessage, LoggerName name, LogLevel level);

    /// <summary>
    /// User by Logger to format a user supplied Exception.
    /// </summary>
    /// <param name="ex">The user's exception</param>
    /// <param name="name">The name of the Logger formatting the exception</param>
    /// <param name="level">The level of the exception</param>
    /// <returns>A formatted string to be written to a log</returns>
    /// <remarks>
    /// Implementations of this delegate should be forgiving of null 
    /// <paramref name="ex">exceptions</paramref>.  <paramref name="name"/> will never be
    /// null.  <paramref name="level"/> will always be a valid <see cref="LogLevel"/>.
    /// </remarks>
    public delegate string ExceptionFormatter(Exception ex, LoggerName name, LogLevel level);
}